package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.model.order.OrderInfo;
import com.atguigu.gmall.order.client.OrderInfoFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author: 李旭
 * @create: 2021-09-14 10:12
 **/
@Controller
public class PayController {


    @Autowired
    private OrderInfoFeignClient orderInfoFeignClient;

    //去支付页面
    @GetMapping("/pay.html")
    public String pay(Long orderId, Model model){
        OrderInfo orderInfo = orderInfoFeignClient.getOrderInfo(orderId);
        model.addAttribute("orderInfo",orderInfo);
        //查询订单金额 及相关信息
        return "payment/pay";
    }

    //跳转到成功页面
    @GetMapping("/pay/success.html")
    public String success(){
        return "payment/success";
    }
}
